import gradio as gr

def reverse(words):
    return words[::-1]

# 构建页面
with gr.Blocks() as demo:
    gr.Markdown("# 我能反转你写的句子")
    with gr.Row():
        input = gr.Textbox(label="请输入句子")
        output = gr.Textbox(label="输出")
    btn = gr.Button("运行")

    btn.click(fn=reverse, inputs=input, outputs=output)

demo.launch()
